//
//  JHSOnceCureViewController.m
//  JHSSweep
//
//  Created by YanYaxing on 2017/3/26.
//  Copyright © 2017年 JHDS. All rights reserved.
//

#import "JHSOnceCureViewController.h"
#import "JHSOnceCureTypeModel.h"

//曾经治疗的枚举---手术治疗operation、药物治疗drug、保守察看watch
typedef enum {
    
    JHSOnceCureEnumOperation = 0,//手术治疗
    JHSOnceCureEnumDrug,//药物治疗
    JHSOnceCureEnumWatch, //保守察看
    
}JHSOnceCureEnum;//枚举名称


@interface JHSOnceCureViewController ()

@property (nonatomic,strong) JHSOnceCureTypeModel *model;

@end



static NSString *CELLID = @"CellID";

@implementation JHSOnceCureViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //注册CELL
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CELLID];
}



#pragma mark - 数据源方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CELLID forIndexPath:indexPath];
    switch (indexPath.row) {
        case JHSOnceCureEnumOperation:
            cell.textLabel.text=@"手术治疗";
            break;
        case JHSOnceCureEnumDrug:
            cell.textLabel.text=@"药物治疗";
            break;
        case JHSOnceCureEnumWatch:
            cell.textLabel.text=@"保守察看";
            break;
        default:
            break;
    }
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    JHSOnceCureTypeModel *model=[JHSOnceCureTypeModel new];

    
    switch (indexPath.row) {
        case JHSOnceCureEnumOperation:{
            model.once_type_name=@"手术治疗";
        }
            break;
        case JHSOnceCureEnumDrug:
            model.once_type_name=@"药物治疗";
            break;
        case JHSOnceCureEnumWatch:
            model.once_type_name=@"保守察看";
            break;
            
        default:
            break;
    }
    _model=model;
    
    [self.delegate setOnceCure:self withModel:_model];
    
    [self.navigationController popViewControllerAnimated:YES];
}

//- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
//    
//    switch (indexPath.row) {
//        case JHSOnceCureEnumOperation:
//            _model.once_type_name=@"手术治疗";
////            cell.textLabel.text=@"手术治疗";
//            break;
//        case JHSOnceCureEnumDrug:
//            _model.once_type_name=@"药物治疗";
////            cell.textLabel.text=@"药物治疗";
//            break;
//        case JHSOnceCureEnumWatch:
//            _model.once_type_name=@"保守察看";
////            cell.textLabel.text=@"保守察看";
//            break;
//            
//        default:
//            break;
//    }
//    
//    
//    [self.delegate setOnceCure:self withModel:_model];
//    
//    [self.navigationController popViewControllerAnimated:YES];
//    
//}

@end
